class Register:
	def __init__(self):
		self.Reset()
	def Reset(self):
		self.__map={}
	def Register(self,func,file_types):
		for name in file_types:
			self.RegisterFunc(func,name)
	def RegisterFunc(self,func,name):
		if not self.__map.has_key(name):
			self.__map[name]=[]
		self.__map[name].insert(0,func) # override 
	def CallAll(self,name,args):
		if self.__map.has_key(name):
			for func in self.__map[name]:
				apply(func,args)
	def GetAll(self,name):
		if self.__map.has_key(name):
			return self.__map[name]
		return []

def RegisterSyntax(func,*file_types):
	_syntax.Register(func,file_types)
def RegisterKeys(func,*file_types):
	_keys.Register(func,file_types)
def RegisterMenu(func,*file_types):
	_menus.Register(func,file_types)
def Reset():
	_syntax.Reset()
	_keys.Reset()
	_menus.Reset()

_syntax=Register()
_keys=Register()
_menus=Register()

